package com.bfly.mall.advert.service.impl;

import com.bfly.core.base.service.BaseServiceImpl;
import com.bfly.mall.advert.entity.CouponExpensesRecord;
import com.bfly.mall.advert.service.ICouponExpensesRecordService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @author 长沙商脉科技有限公司
 * @date 2020/9/20 13:05
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS)
public class CouponExpensesRecordServiceImpl extends BaseServiceImpl<CouponExpensesRecord, Integer> implements ICouponExpensesRecordService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void save(int couponId, String code, String orderNo) {
        CouponExpensesRecord couponExpensesRecord = new CouponExpensesRecord();
        couponExpensesRecord.setCode(code);
        couponExpensesRecord.setOrderNo(orderNo);
        couponExpensesRecord.setCouponId(couponId);
        couponExpensesRecord.setCreateDate(new Date());
        super.save(couponExpensesRecord);
    }
}
